<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>{:cache('site_name')}后台管理系统</title>
    <link rel="stylesheet" type="text/css" href="__LOGIN1__/css/normalize.css" />
    <link rel="stylesheet" type="text/css" href="__LOGIN1__/css/demo.css" />
    <!--必要样式-->
    <link rel="stylesheet" type="text/css" href="__LOGIN1__/css/component.css" />
    <!--[if IE]>
    <script src="__LOGIN1__/js/html5.js"></script>
    <![endif]-->
</head>
<body>
<div class="container demo-1">
    <div class="content">
        <div id="large-header" class="large-header">
            <canvas id="demo-canvas"></canvas>
            <div class="logo_box">
                <h3>{:cache('site_name')} 欢迎你</h3>
                <form method="post"  id="login-form">
                    <div class="input_outer">
                        <span class="u_user"></span>
                        <input name="login_name" id="name" class="text" style="color: #FFFFFF !important" type="text" placeholder="请输入账号">
                    </div>
                    <div class="input_outer">
                        <span class="us_uer"></span>
                        <input name="pwd" class="text" id="pwd" style="color: #FFFFFF !important; position:absolute; z-index:100;" value="" type="password" placeholder="请输入密码">
                    </div>
                    <div id="errMsg"  style="color: red;padding-left: 50px;" hidden>用户名不能为空！</div>
                    <div class="mb2"><a class="act-but submit" href="javascript:login();" style="color: #FFFFFF">登录</a></div>
                </form>
            </div>
        </div>
    </div>
</div><!-- /container -->
<script src="__LOGIN1__/js/tweenlite.min.js"></script>
<script src="__LOGIN1__/js/easepack.min.js"></script>
<script src="__LOGIN1__/js/raf.js"></script>
<script src="__LOGIN1__/js/demo-1.js"></script>
<script src="/public/static/admin/assets/js/jquery.min.js?v=2.1.4"></script>
<script src="/public/static/admin/assets/js/jquery.serializejson.min.js"></script>
<script>
    //回车登录
    $(document).keyup(function(event){
        if(event.keyCode ==13){
            login();
        }
    });

    /*登录*/
    function login() {
        //判空
        var name=$("#name").val();
        var pwd=$("#pwd").val();
        if(name==""){
            showErr("用户名不能为空！");
            return;
        }

        if(pwd==""){
            showErr("密码不能为空！");
            return;
        }
        $.ajax({
            url: "{:U('admin/index/dologin')}",
            type: 'POST',
            dataType: 'json',
            data:$("#login-form").serializeJSON(),
            success: function (res) {
                if (res.rc == 0) {
                    location.replace("/admin/index/index");
                } else {
                    showErr(res.msg);
                }
            }
        });
    }

    /**
     * 显示错误信息
     * @param str
     */
    function showErr(str) {
        $("#errMsg").html(str);
        $("#errMsg").show();
    }
</script>
</body>
</html>